<?php

//Family
class Form_Family_Create extends Base_Form
{
    public function init()
    {
		$this->addElements(array(
			// Add an username element
            new Zend_Form_Element_Select('gid', array(
                'required'   => true,
                'label'      => 'Group:',
                'multiOptions' => array(),
                'filters'    => array('StringTrim'),
                'validators' => array(
					array('validator'=> 'Int')
                )
            )),
			// Add an username element
            new Zend_Form_Element_Text('fid', array(
                'required'   => true,
                'label'      => 'Family id:',
                'multiOptions' => array(),
                'filters'    => array('StringTrim'),
                'validators' => array(
					array('validator'=> 'Int')
                )
            )),
			// Add an username element
            new Zend_Form_Element_Text('master', array(
                'required'   => true,
                'label'      => 'Master Name:',
                'filters'    => array('StringTrim'),
                'validators' => array(
					array('validator' => 'StringLength', 'options' => array(4,30))
                )
            )),
        ));

        $this->addDisplayGroup(
            array('gid', 'fid', 'master'), 'family',
			array(
				'legend' => 'Family'
			)
		);
    }
    
    public function setGroupOptions($groups)
    {
        foreach ($groups as $group) {
            $options[$group->gid] = $group->name;
        }
        return $this->gid->setMultiOptions($options);
    }
}